/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package mnstudent.businessLayer;

import mnstudent.dataacesslayer.PriorityObjectDetailDAL;
import mnstudent.datatranferobject.PriorityObjectDetailDTO;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import org.jdesktop.swingx.JXTable;

/**
 *
 * @author 11520_000
 */
public class PriorityObjectDetailBLL {
    PriorityObjectDetailDAL _subPriorityDAL;
    
    
    public PriorityObjectDetailBLL()
    {
        _subPriorityDAL = new PriorityObjectDetailDAL();
    }
    
     /**
     * Ham lay tat ca cac Chi Tiet Doi tuong
     *
     * @return boolean
     */
    public ResultSet getAllPrioritySubDetail() {
        return _subPriorityDAL.getAllPrioritySubDetail();
    }
    
    public ResultSet getPrioritySubDetailByIdStudent(String id) {
        return _subPriorityDAL.getPrioritySubDetailByIdStudent(id);
    }
    
    public ArrayList<PriorityObjectDetailDTO> getArrayPrioritySubDetailByIdStudent(String id)
    {
        ArrayList<PriorityObjectDetailDTO> temp = new ArrayList<>();
        ResultSet rs = getPrioritySubDetailByIdStudent(id);
        try {
            while(rs.next())
            {
                System.out.println("ID: " + rs.getNString(1) + " ID DT: " + rs.getNString(2));
                //temp.add(new PriorityObjectDetailDTO(rs.getNString(1), rs.getNString(2)));
            }
        } catch (SQLException ex) {
            ex.printStackTrace();
        }
        return temp;
    }
    /**
     * Ham insert mot chi tiết đối đượng xuống database
     * @param _subDetail
     * @return 
     */
    public boolean insertPrioritySubDetail(PriorityObjectDetailDTO _subDetail)
    {
        return _subPriorityDAL.insertPrioritySubDetail(_subDetail);
    }
    
    public boolean insertArrayPrioritySubDetail(ArrayList<PriorityObjectDetailDTO> _arrSubDetail)
    {
       return _subPriorityDAL.insertArrayPrioritySubDetail(_arrSubDetail);
    }
    
    public boolean deletePrioritySubDetailFromDatabase(String _subDetailID)
    {
        return _subPriorityDAL.deletePrioritySubDetailFromDatabase(_subDetailID);
    }
}
